package com.hefeng.unit.service.impl;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hefeng.unit.domain.GyBanner;
import com.hefeng.unit.mapper.GyBannerMapper;
import com.hefeng.unit.service.GyBannerService;
import com.hefeng.unit.service.GyUserOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class GyBannerServiceImpl extends ServiceImpl<GyBannerMapper,GyBanner> implements GyBannerService {
    @Autowired
    private GyBannerMapper gyBannerMapper;


    @Override
    public List<Map<String, Object>> getWxBannerList() {
        List<Map<String, Object>> bannerList=new ArrayList<>();
        bannerList=this.listMaps(Wrappers.lambdaQuery(new GyBanner()).select(GyBanner::getBannerId,GyBanner::getBannerTitle,GyBanner::getBannerImageUrl,GyBanner::getBannerTargetUrl,GyBanner::getBannerSort)
                .orderByAsc(GyBanner::getBannerSort).last("limit 3"));
        return bannerList;
    }
}
